package com.example.idlefish.Message

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

@Dao
interface MessageChatDAO {
    @Query("SELECT * FROM messageChat WHERE (senderID = :senderID AND receiverID = :receiverID) OR (senderID = :receiverID AND receiverID = :senderID) ORDER BY messageTime")
    fun getMessagesByID(senderID: Int, receiverID: Int): MutableList<MessageChatData>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertMessage(message: MessageChatData)

    @Query("DELETE FROM messageChat")
    fun deleteAllMessages()
}